<?php
/* SVN FILE: $Id: default.thtml 3972 2006-11-25 23:05:36Z phpnut $ */
/**
 *
 * PHP versions 4 and 5
 *
 * CakePHP :  Rapid Development Framework <http://www.cakephp.org/>
 * Copyright (c)	2006, Cake Software Foundation, Inc.
 *								1785 E. Sahara Avenue, Suite 490-204
 *								Las Vegas, Nevada 89104
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @copyright		Copyright (c) 2006, Cake Software Foundation, Inc.
 * @link				http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
 * @package			cake
 * @subpackage		cake.cake.libs.view.templates.pages
 * @since			CakePHP v 0.10.0.1076
 * @version			$Revision: 3972 $
 * @modifiedby		$LastChangedBy: phpnut $
 * @lastmodified	$Date: 2006-11-25 17:05:36 -0600 (Sat, 25 Nov 2006) $
 * @license			http://www.opensource.org/licenses/mit-license.php The MIT License
 */
 
$infolinks = array($html->link('Home','/'), $html->link("Blog",'http://wmcoop.blogspot.com'), $html->link("Calendar",'/pages/calendar'), $html->link("TweetBoard",'http://www.westmichigancoop.com/members/tweets'), $html->link("More Info...",'http://wiki.westmichigancoop.com'));
 
$loggedIn = ($current_user['auth_type'] != 'guest');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo SITE_NAME, ' : ', $title_for_layout;?></title>
<link rel="alternate" type="application/rss+xml" title="West Michigan Coop Blog - RSS" href="<?=Configure::read('Blog.rss')?>" />
<?php print $html->charset('UTF-8'); ?>
<?php 
if (isset($javascript)) {
  print $javascript->link('prototype');
  print $javascript->link('scriptaculous.js?load=effects');
  if (isset($lightbox)) {
  	print $javascript->link('lightbox');
  }
}
?>
<link rel="icon" href="<?php echo $this->webroot . 'favicon.png';?>" type="image/png" />
<link rel="shortcut icon" href="<?php echo $this->webroot . 'favicon.png';?>" type="image/png" />
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/reset-fonts-grids/reset-fonts-grids.css">
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/base/base-min.css">
<?php 
//echo $html->css('pngHack','stylesheet', array('media'=>'screen'));
//echo $html->css('index','stylesheet',array('media'=>'screen'));
echo $html->css('main','stylesheet',array('media'=>'screen'));
echo $html->css('print','stylesheet',array('media'=>'print'));
if (isset($lightbox)) {
	print $html->css('lightbox','stylesheet');
}
?>
</head>
<body>
 <div id="doc2" class="yui-t2">
  <div id="hd">
   	<?php echo $html->image('header.png',array('id'=>'head','width'=>546,'height'=>40, 'alt'=>'West Michigan Cooperative')) . "\n";
   	
  $searchText = '';
  if (isset($this->params['form'])) {
  	if (isset($this->params['form']['search'])) {
  		$searchText = $this->params['form']['search'];
  	}
  }
  ?>
   	<a href="<?php echo $html->url('/');?>"><?php echo $html->image('logo-small.png',array('width'=>89,'height'=>141,'id'=>'logo'));?></a>
  <div id="toolbar">
  	<div id="quicksearch">
  	<form method="post" action="<?php echo $html->url('/products/basicSearch');?> ">
		  <p><label for="search">Product Search: </label><input type="text" name="search" value="<?php echo $searchText;?>"/>
		  <input type="submit" class="submit" value="Search"/></p>
		</form>
		
		</div>
  <?php
  if (!$loggedIn) {
    echo '<div id="nav"><p>', join($infolinks, ' &nbsp; '), '</p></div>', "\n";
    echo '<div id="logininfo"><p>You are not logged in.</p></div>' . "\n";
  } else {
    echo '<div id="logininfo"><p>', $html->link('My Basket','/members/basket'), ' &nbsp; ', $html->link('Main Menu','/members/menu'), ' &nbsp; You are logged in as <strong>'.$current_user['username'].'</strong>';
    if ($current_user['auth_type'] != 'member') {
      echo ' (' . $current_user['auth_type'] . ')';
    }
    echo ' &nbsp; ', $html->link('Log Out', '/members/logout'), '</p></div>', "\n";
		if ($current_user['auth_type'] == AUTH_CASH) {
			echo '<div><form action="', $html->url('/members/search'), '" method="POST">
		<p><label for="data[Member][field]">Member search</label>
	<select name="data[Member][field]">
		<option value="last_name">Last Name</option>
		<option value="first_name">First Name</option>
		<option value="email_address">Email</option>
	</select>
	<input type="text" name="data[Member][value]"/>
	<input type="submit"/></p>
</form></div>';
		}
  }
  ?>
  	</div>
  </div>
  <div id="bd">
  	<div id="yui-main">
  		<div id="content" class="yui-b">
   <?php if ($session->check('Message.flash'))
          {
            $session->flash();
          }
		if (isset($current_basket)) {
			$basket_member = $this->requestAction('/members/getMemberInfo/' . $current_basket);
			echo '<p class="help">Currently Editing ', $basket_member['Member']['first_name'], ' ', $basket_member['Member']['last_name'], "'s basket. ", $html->link('[Stop Editing]', '/members/clearCurrentBasket');
		}
          echo $content_for_layout;
   ?>
   	</div>
   </div>
	<div id="sidebar" class="yui-b">
	<?php
	
  if (!MAINT_ON) {
  	if (!$loggedIn) {
	?>
    <div id="login" class="box">
			<form action="<?=$html->url('/members/login')?>" method="post">
    	<?=$form->input('Member.username', array('label'=>'username:'));?>
   		<?=$form->input('Member.password', array('label'=>'password:'));?>
    	<?=$form->submit('login',array('class'=>'submit'))?>
    	</form>
			<p><?=$html->link('Forgot Username?','/members/forgotName')?></p>
			<p><?=$html->link('Forgot Password?','/members/forgotPassword')?></p>
			<p><?=$html->link('New User?', '/pages/signup')?></p>
    </div>
  <?php
  	} else {
  ?>
  	<div class="box">
  		<h3>Products</h3>
  		<ul>
  		<?php
  			echo $html->tag('li', $html->link('by Producers', '/producers'));
  			echo $html->tag('li', $html->link('by Categories', '/categories'));
  			echo $html->tag('li', $html->link('New Products', '/products/view/new'));
  			echo $html->tag('li', $html->link('Updated Products', '/products/view/changed'));
  		?>
  		</ul>
  	</div>
  <?php
  	}
  	if (isset($quicklinks)) {
  		echo '<div id="quickies" class="box"><h3>On This Page</h3><ul>';
  		foreach($quicklinks as $link) {
  			echo '<li>' . $link . "</li>\n";
  		}
  		echo '</ul></div>';
  	}
  } else {
  	echo '<div class="box"><p>Standby, while we perform maintenance on the site.  You should be able to log in shortly.</p></div>';
  }
	if($current_delivery > 0) {
					//echo "true";
					$d = array('Delivery'=>Configure::read('Delivery'));
					
					$df = '%A, %B %e';
					$tf = 'g:i a';
					//pr($d);
					?>
  <div id="deliveryInfo" class="box">
    <h3><a href="/pages/calendar">Calendar</a></h3>
	   <h4>Ordering period:</h4>
		<p><?=strftime($df,strtotime($d['Delivery']['order_open']));?> - </p>
		<p><?=strftime($df,strtotime($d['Delivery']['order_closed'] . ' -1 day'));?></p>
		<h4>Dropoff and Pickup Day:</h4>
		<p><?=strftime($df,strtotime($d['Delivery']['delivery_open']));?></p>
		<h4>Customers:</h4>
		<p><?=date($tf, strtotime($d['Delivery']['pickup_open'])) . ' - ' . date($tf, strtotime($d['Delivery']['pickup_closed']))?></p>
		<h4>Producers/Volunteers:</h4>
		<p><?=date($tf, strtotime($d['Delivery']['delivery_open'])) . ' - ' . date($tf, strtotime($d['Delivery']['delivery_closed']))?></p>
	</div>
<?php
	}
  foreach(array('location', 'contact', 'volunteer') as $block) {
  	echo $html->div('box', $this->renderElement('blocks/' . $block), array('id' => $block . '_box'));
  }
?>
	</div>
	
  </div>
  <div id="ft">
   <span class='compact'>Questions?: <a href='mailto:help@westmichigancoop.com'>help@westmichigancoop.com</a> |
    <?=join(array_merge($infolinks, array($html->link("Contact Us",'/pages/contact'), $html->link("Terms and Conditions",'/members/terms'), $html->link("Main Menu",'/members/menu'))), ' | ')?>
   </span>
   <a href="http://www.cakephp.org/" target="_new">
    <?php echo $html->image('cake.power.png', array('alt'=>"CakePHP : Rapid Development Framework", 'border'=>"0"));?>
   </a>
  </div>
 </div>
 <?php 
 //debug(DEBUG,true);
 echo $cakeDebug;
 ?>
<?php
	if (!(TESTING)) {
?>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2820786-2";
urchinTracker();
</script>
<?php	
	}
?>
</body>
</html>